﻿<?php
	require 'config.php';
		
	$link = mysql_connect($DBServer, $DBUser, $DBPassword);
	mysql_select_db($DBName, $link);		
	mysql_query("SET NAMES 'utf8';", $link);
	mysql_query("SET CHARACTER SET 'utf8';", $link);
	mysql_query("SET SESSION collation_connection = 'utf8_general_ci';", $link);
	
	$query = "SELECT * FROM users ORDER BY rating DESC LIMIT 100";	
	$results = mysql_query($query);	
	
	echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
	echo "<players>\n";	
	while($line = mysql_fetch_assoc($results)) 
	{	
		$uid = " uid="."\"".$line['uid']."\"";
		$name = " name="."\"".$line['name']."\"";		
		$rating = " rating="."\"".$line['rating']."\"";		

		echo "<player". $uid . $name . $rating . "/>\n";
	}	
	echo "</players>";	
	
	mysql_close($link);	
?>